package com.github.livebase.log;

import com.github.livebase.util.LivePool;

/**
 * @ClassName LogUtil
 * @description:
 * @author: biao532
 * @create: 2024-02-05 21:25
 * @Version 1.0
 **/
public class LogUtil {
    private static LivePool<ToStringRef> livePool = new LivePool<ToStringRef>(4) {
        @Override
        protected ToStringRef createNewObject() {
            return new ToStringRef();
        }
    };
    public static String ERROR_OCCURRED = "an error occurred during {}";

    public static ToStringRef acquireRef(Object obj) {
        ToStringRef ref = livePool.acquire();
        ref.setObject(obj);
        return ref;
    }

    public static boolean releaseRef(ToStringRef ref) {
        if (ref != null) {
            ref.setObject(null);
        }
        return livePool.release(ref);
    }
}
